package bm.com.project.server.unit.controller;

import bm.com.framework.common.config.EnumRoute;
import bm.com.project.server.common.dto.DemandsSearchDTO;
import bm.com.project.server.common.dto.ObtainBaseDTO;
import bm.com.project.server.unit.dto.BmDemandsDTO;
import bm.com.project.server.unit.service.BmDemandsService;
import bm.com.framework.common.resp.ResultVO;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping(EnumRoute.UnitRoute.BASE)
public class BmDemandsController {

    @Resource
    BmDemandsService bmDemandsService;

    /**
     * 保存需求
     *
     * @param demands
     * @return
     */
//    @ApiOperation("添加工单信息")
    @PostMapping(EnumRoute.UnitRoute.Demands.SAVE_DEMANDS)
    public ResultVO save(@RequestBody BmDemandsDTO demands) {
        return bmDemandsService.saveDemands(demands);
    }

    /**
     * 获取列表信息
     *
     * @param demandsSearchDTO
     * @return
     */
    @PostMapping(EnumRoute.UnitRoute.Demands.GET_DEMANDS_LIST)
    public ResultVO getList(@RequestBody DemandsSearchDTO demandsSearchDTO) {
        return bmDemandsService.getDemandsList(demandsSearchDTO);
    }

    /**
     * 获取需求详情
     * @return
     */
    @PostMapping(EnumRoute.UnitRoute.Demands.GET_DEMANDS_DETAIL)
    public ResultVO getDetail(@RequestBody ObtainBaseDTO obtainBaseDTO){
       return bmDemandsService.getDemandsDetail(obtainBaseDTO);
    }

}
